package org.sidora.strata.category;

import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
import org.openide.util.NbBundle;
import org.openide.util.Utilities;
import org.openide.windows.TopComponent;

/**
 * Action wich shows CategoryForm component
 * @author Enric Tartera, Juan Manuel Gimeno, Roger Masgoret
 * @version 1.0
 */
public class CategoryFormAction extends AbstractAction {
    
    public CategoryFormAction() {
        super(NbBundle.getMessage(CategoryFormAction.class, "CTL_CategoryFormAction"));
        putValue(SMALL_ICON, new ImageIcon(Utilities.loadImage(CategoryFormTopComponent.ICON_PATH, true)));
    }
    
    public void actionPerformed(ActionEvent evt) {
        TopComponent win = CategoryFormTopComponent.findInstance();
        win.open();
        win.requestActive();
    }
    
    public void cerrar(){
        CategoryFormTopComponent win = CategoryFormTopComponent.findInstance();
        win.close();
        
    }
    
}
